-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP feat: add option sets whether reset args when reset #1059
base: develop
Are you sure you want to change the base?
Conversation
pkg/protocol/args.go
Outdated
buf []byte | ||
args []argsKV | ||
buf []byte | ||
reuse bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要
pkg/protocol/args.go
Outdated
reuse bool | ||
} | ||
|
||
func (a *Args) SetReuseArgs(b bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要
@@ -74,6 +79,9 @@ func (a *Args) Set(key, value string) { | |||
|
|||
// Reset clears query args. | |||
func (a *Args) Reset() { | |||
if a.reuse { | |||
a.args = []argsKV{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要
@@ -74,6 +79,9 @@ func (a *Args) Set(key, value string) { | |||
|
|||
// Reset clears query args. | |||
func (a *Args) Reset() { | |||
if a.reuse { | |||
a.args = []argsKV{} | |||
} | |||
a.args = a.args[:0] | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
允许自定义 Reset 函数的行为即可
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional): 添加 WithDisableReuseArgs
(Optional) Which issue(s) this PR fixes:
(Optional) The PR that updates user documentation: